<?php

class Contact extends AppModel {

    var $useTable = false;
    var $_schema = array(
        'name' => array('type' => 'string', 'length' => 100),
        'email' => array('type' => 'string', 'length' => 255),
        'confirm_email' => array('type' => 'string', 'length' => 255),
        'mobile' => array('type' => 'string', 'length' => 255),
        'PropertyNo' => array('type' => 'string', 'length' => 255),
        'content' => array('type' => 'text')
    );
    var $validate = array(
        'name' => array(
            'rule' => array('minLength', 1),
            'message' => 'Name is required'),
        'email' => array(
            'email' => array(
                'rule' => 'email',
                'message' => 'Must be a valid email address'
            ),
        ),
        'confirm_email' => array(
            'identicalFieldValues' => array(
                'rule' => array('identicalFieldValues'),
                'message' => 'email & confirm email do not match'
            )
        )
    );

    function identicalFieldValues($params) {
        if ($this->data['Contact']['email'] != $this->data['Contact']['confirm_email']) {
            return false;
        }
        return true;
    }

}